var randomPost, randomStart;
(function (e, d, h) {
    var g = function (b) {
        var a = d.createElement("script");
        a.type = "text/javascript";
        a.src = b;
        h.appendChild(a)
    }, f = function (b, a) {
            return Math.floor(Math.random() * (a - b + 1)) + b
        };
    randomPost = function (r) {
        var p, o, l, m = document.getElementById("random-posts"),
            q = r.feed.entry,
            Z = (e.innerWidth > 430 && ("media$thumbnail" in q[0] || "media$thumbnail" in q[1] || "media$thumbnail" in q[2] || "media$thumbnail" in q[3] || "media$thumbnail" in q[4])) ? true : false,
            b = "<h2>Tulisan Lainnya:</h2>";
        b += (Z ? '<ol>' : '<ul>');
        for (var k = 0, n = q.length; k < n; k++) {
            o = ("summary" in q[k]) ? (q[k].summary.$t.replace(/<.*?>/g, "")) : "";
            o = o.length > 200 ? o.substring(0, 200) + "&hellip;" : o;
            l = ("media$thumbnail" in q[k]) ? q[k].media$thumbnail.url.replace(/\/s[0-9]+(-c)?/, "/s80-c") : "";
            for (var c = 0, a = q[k].link.length; c < a; c++) {
                p = (q[k].link[c].rel == "alternate") ? q[k].link[c].href : "#"
            }
            b += "<li>" + (Z ? '<a href="' + p + '"><img src="' + l + '" alt="" width="80" height="80"></a>' : "") + '<a href="' + p + '">' + q[k].title.$t + '</a>' + (Z ? '<span class="summary">' + o + '</span><div style="clear:both;"></div>' : "") + '</li>'
        }
        b += (Z ? '</ol>' : '</ul>');
        m.innerHTML = b + '<div style="clear:both"></div>'
    };
    randomStart = function (a) {
        var b = f(1, (a.feed.openSearch$totalResults.$t - 5));
        g("http://kod-blogazine.blogspot.com/feeds/posts/summary?alt=json-in-script&orderby=updated&start-index=" + b + "&max-results=5&callback=randomPost")
    };
    g("http://kod-blogazine.blogspot.com/feeds/posts/summary?alt=json-in-script&max-results=0&callback=randomStart")
})(window, document, document.getElementsByTagName("head")[0]);